/**
 * 
 */
package com.ls.fw.mvc.springmvc.support.freemaker;

import com.ls.fw.mvc.springmvc.support.freemaker.bean.GenControllerPara;
import com.ls.fw.mvc.springmvc.support.freemaker.engine.ControllerFreeMarker;

/**
 * @author Defender
 * 2014年2月27日 下午8:41:25
 */
public class GenerateControllerJava {
		private ControllerFreeMarker servicemarker = null;

		private boolean coverIfExist = true;
		public GenerateControllerJava() {
			super();
			this.servicemarker = new ControllerFreeMarker();
		}

		/**
		 *  默认主键类型"Long"
		 * @author Defender
		 * 2014年2月27日 下午8:58:09
		 * @throws Exception 
		 */
		public GenerateControllerJava(String dir,boolean coverIfExist) throws Exception {
			 servicemarker = new ControllerFreeMarker(dir);
			 servicemarker.setCoverIfExist(coverIfExist);
		}

		public GenerateControllerJava(String dir) throws Exception {
			 this(dir, true);
		}
		public void generateController(GenControllerPara para ) throws Exception{
			servicemarker.buildTemplate(para);
		}
		
		public void generateController(Class entity,Class vo,Class form
				, Class service, Class serviceImp,String mappingValue,String controllerPackage) throws Exception{
			servicemarker.buildTemplate(entity, vo, form, service, serviceImp,mappingValue, controllerPackage);
		} 
}
